package com.globalwave.datasync;

import com.globalwave.common.C;



public class SyncConfig implements Cloneable {
	final public static String MODE_INCREMENT_INSERT = "I";
	final public static String MODE_ONE_BY_ONE = "O";
	final public static String MODE_MOVE = "M";
	
	final public static Integer DIRECTION_ONE_WAY = 1;
	final public static Integer DIRECTION_TWO_WAY = 2;
	
	private Long syncConfigId ;
	private String syncConfigCode ;
	
    private String modeType ;
    private Integer fetchSize ;
    private String flagColumn ;
    private Long currentSequence ;
    
    private Integer isLog ;

    private SyncTable source ;
    private SyncTable destination ;
    
    public SyncConfig(Long syncConfigId, String syncConfigCode) {
    	this.syncConfigId = syncConfigId ;
    	this.syncConfigCode = syncConfigCode ;
    	this.source = new SyncTable(this) ;
    	this.destination = new SyncTable(this) ;
    }

    /**
     * 源查询SQL
     */
    private String sourceQuerySQL ;
    /**
     * 源update SQL
     */
    private String sourceUpdateSQL ;
    /**
     * 源delete SQL
     */
    private String sourceDeleteSQL ;
    /**
     * 目的查询SQL
     */
    private String destinationQuerySQL ;
    /**
     * 目的insert SQL
     */
    private String destinationInsertSQL ;
    /**
     * 目的update SQL
     */
    private String destinationUpdateSQL ;
    /**
     * 目的delete SQL
     */
    private String destinationDeleteSQL ;
    
	public Long getSyncConfigId() {
		return syncConfigId;
	}
	public void setSyncConfigId(Long syncConfigId) {
		this.syncConfigId = syncConfigId;
	}
	public String getSyncConfigCode() {
		return syncConfigCode;
	}
	public void setSyncConfigCode(String syncConfigCode) {
		this.syncConfigCode = syncConfigCode;
	}
	public String getModeType() {
		return modeType;
	}
	public void setModeType(String modeType) {
		this.modeType = modeType;
	}
	public Integer getFetchSize() {
		return fetchSize;
	}
	public void setFetchSize(Integer fetchSize) {
		this.fetchSize = fetchSize;
	}
	public String getFlagColumn() {
		return flagColumn;
	}
	public void setFlagColumn(String flagColumn) {
		this.flagColumn = flagColumn;
	}
	public boolean isLog() {
		return C.TRUE_INTEGER.equals(isLog) ;
	}
	public void setLog(Integer isLog) {
		this.isLog = isLog ;
	}
	public Long getCurrentSequence() {
		return currentSequence;
	}
	public void setCurrentSequence(Long currentSequence) {
		this.currentSequence = currentSequence;
	}
	public SyncTable getSource() {
		return source;
	}
	public void setSource(SyncTable source) {
		this.source = source;
	}
	public SyncTable getDestination() {
		return destination;
	}
	public void setDestination(SyncTable destination) {
		this.destination = destination;
	}
	public String getSourceQuerySQL() {
		return sourceQuerySQL;
	}
	public void setSourceQuerySQL(String sourceQuerySQL) {
		this.sourceQuerySQL = sourceQuerySQL;
	}
	public String getDestinationQuerySQL() {
		return destinationQuerySQL;
	}
	public void setDestinationQuerySQL(String destinationQuerySQL) {
		this.destinationQuerySQL = destinationQuerySQL;
	}
	public String getDestinationInsertSQL() {
		return destinationInsertSQL;
	}
	public void setDestinationInsertSQL(String destinationInsertSQL) {
		this.destinationInsertSQL = destinationInsertSQL;
	}
	public String getDestinationUpdateSQL() {
		return destinationUpdateSQL;
	}
	public void setDestinationUpdateSQL(String destinationUpdateSQL) {
		this.destinationUpdateSQL = destinationUpdateSQL;
	}
	public String getDestinationDeleteSQL() {
		return destinationDeleteSQL;
	}
	public void setDestinationDeleteSQL(String destinationDeleteSQL) {
		this.destinationDeleteSQL = destinationDeleteSQL;
	}
    
    
	public String getSourceUpdateSQL() {
		return sourceUpdateSQL;
	}
	public void setSourceUpdateSQL(String sourceUpdateSQL) {
		this.sourceUpdateSQL = sourceUpdateSQL;
	}
	public String getSourceDeleteSQL() {
		return sourceDeleteSQL;
	}
	public void setSourceDeleteSQL(String sourceDeleteSQL) {
		this.sourceDeleteSQL = sourceDeleteSQL;
	}
	public Object clone() {
		SyncConfig copy = (SyncConfig)this.clone() ;

	    this.sourceQuerySQL = null ;
	    this.sourceUpdateSQL = null;
	    this.sourceDeleteSQL = null ;
	    this.destinationQuerySQL = null ;
	    this.destinationInsertSQL = null ;
	    this.destinationUpdateSQL = null ;
	    this.destinationDeleteSQL = null ;
	    
	    return copy ;
	    
	}
}
